package com.run.motion.service.impl;

import java.util.List;

import com.run.motion.entity.Gym;
import com.run.motion.mapper.GymMapper;
import com.run.motion.service.IGymService;
import com.run.motion.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 健身房Service业务层处理
 * 
 * @author lyq
 * @date 2022-03-26
 */
@Service
public class GymServiceImpl implements IGymService
{
    @Autowired
    private GymMapper gymMapper;

    /**
     * 查询健身房
     * 
     * @param id 健身房主键
     * @return 健身房
     */
    @Override
    public Gym selectGymById(Long id)
    {
        return gymMapper.selectGymById(id);
    }

    /**
     * 查询健身房列表
     * 
     * @param gym 健身房
     * @return 健身房
     */
    @Override
    public List<Gym> selectGymList(Gym gym)
    {
        return gymMapper.selectGymList(gym);
    }

    /**
     * 新增健身房
     * 
     * @param gym 健身房
     * @return 结果
     */
    @Override
    public int insertGym(Gym gym)
    {
        gym.setCreateTime(DateUtils.getNowDate());
        return gymMapper.insertGym(gym);
    }

    /**
     * 修改健身房
     * 
     * @param gym 健身房
     * @return 结果
     */
    @Override
    public int updateGym(Gym gym)
    {
        return gymMapper.updateGym(gym);
    }

    /**
     * 批量删除健身房
     * 
     * @param ids 需要删除的健身房主键
     * @return 结果
     */
    @Override
    public int deleteGymByIds(Long[] ids)
    {
        return gymMapper.deleteGymByIds(ids);
    }

    /**
     * 删除健身房信息
     * 
     * @param id 健身房主键
     * @return 结果
     */
    @Override
    public int deleteGymById(Long id)
    {
        return gymMapper.deleteGymById(id);
    }
}
